<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
        <link href="${pageContext.request.contextPath}/images/favicon.ico" mce_href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <title>设置</title>
        <link rel="stylesheet" href="${pageContext.request.contextPath}/css/weui.css"/>
        <link rel="stylesheet" href="${pageContext.request.contextPath}/css/wechat.css"/>
    </head>
    <body ontouchstart>
        <div class="container js_container">

        </div>
            <div class="page">
                <div class="bd">
                    <div class="weui_cells_title">以下操作，通过微信向您发送通知</div>
                    <div class="weui_cells weui_cells_form">
                        <div class="weui_cell weui_cell_switch">
                            <div class="weui_cell_hd weui_cell_primary">消费通知</div>
                            <div class="weui_cell_ft">
                                <input class="weui_switch" type="checkbox" <c:if test="${map['1']==1 }">checked="checked"</c:if> onchange="setting.advices(this,'1')"  id="advices"/>
                                
                            </div>
                        </div>
                        <div class="weui_cell weui_cell_switch">
                            <div class="weui_cell_hd weui_cell_primary">充值通知</div>
                            <div class="weui_cell_ft">
                                <input class="weui_switch" type="checkbox" <c:if test="${map['2']==1 }">checked="checked"</c:if> onchange="setting.advices(this,'2')" id="topUp"/>
                            </div>
                        </div>
                        <div class="weui_cell weui_cell_switch">
                            <div class="weui_cell_hd weui_cell_primary">补卡通知</div>
                            <div class="weui_cell_ft">
                                <input class="weui_switch" type="checkbox" <c:if test="${map['3']==1 }">checked="checked"</c:if> onchange="setting.advices(this,'3')" id="cardReissue"/>
                            </div>
                        </div>
                        <div class="weui_cell weui_cell_switch">
                            <div class="weui_cell_hd weui_cell_primary">销户通知</div>
                            <div class="weui_cell_ft">
                                <input class="weui_switch" type="checkbox" <c:if test="${map['4']==1 }">checked="checked"</c:if> onchange="setting.advices(this,'4')" id="closingAnAccount"/>
                            </div>
                        </div>
                        <div class="weui_cell weui_cell_switch">
                            <div class="weui_cell_hd weui_cell_primary">转账通知</div>
                            <div class="weui_cell_ft">
                                <input class="weui_switch" type="checkbox" <c:if test="${map['5']==1 }">checked="checked"</c:if> onchange="setting.advices(this,'5')" id="transfer"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            </script>
        <script src="${pageContext.request.contextPath}/js/zepto.min.js"></script>
        <script src="${pageContext.request.contextPath}/js/example.js"></script>
    </body>
<script type="text/javascript">
	var setting = {
			advices : function(doc,type){
				var status = 0;
				if($(doc).attr("checked")){
					status = 1; 
				}
				 $.ajax({
						type : "post",
						url : "${pageContext.request.contextPath}/settings/save",
						data : {type:type,status:status},
						dataType : "json",
						async : true,
						success : function(data) {
							if(data.code*1 == 200){
								alert("修改成功");
							}else{
								alert("修改失败");
							}
						}
					});
			}
	}
</script>
</html>